using UnityEngine;
using System.Collections;

public class CheckBoxPrimarySecondary : MonoBehaviour {
	
	public bool primary = true;
	
	UICheckbox checkBox;
	
	// Use this for initialization
	void Awake () {
		checkBox = gameObject.GetComponent<UICheckbox>();
		
		if(primary){
			checkBox.isChecked = LevelConstants.allowPrimary;	
		}else{
			checkBox.isChecked = LevelConstants.allowSecondary;	
		}
	}
	
	void OnActivate(){

		if(primary){
			if(checkBox.isChecked){
				LevelConstants.allowPrimary = true;
			}else{
				LevelConstants.allowPrimary = false;
			}
		}else{
			if(checkBox.isChecked){
				LevelConstants.allowSecondary = true;
			}else{
				LevelConstants.allowSecondary = false;
			}
		}
	}
	
	void OnGUI(){
		
		if(primary){
			checkBox.isChecked = LevelConstants.allowPrimary;	
		}else{
			checkBox.isChecked = LevelConstants.allowSecondary;	
		}
	}
}
